
import {defineStore} from 'pinia'
import {getHomeList} from '@/api/home'
import type {HomeListData,NavListData,SwipersData, SaleListData,ItemListData } from '@/api/home'
type StateData = {
    HomeList:HomeListData
}

export const useCountStore = defineStore('count',{
    state:():StateData=> {
        return {
            HomeList:{
                swipersData:[],
                titlle:'',
                navList:[],
                saleList:[],
                itemList:[]
            }
        }
    },
    actions:{
    async getHomeList(){
        try{
            const res = await getHomeList()
            // console.log(res.data)
            this.HomeList = res.data
        }catch(e){

        }
    }
        
    },
    getters:{
        titlle():string{
            return this.HomeList.titlle
        },
        navList():NavListData{
            return this.HomeList.navList
        },
        swipersData():SwipersData{
            return this.HomeList.swipersData
        },
        saleListData(): SaleListData{
            return this.HomeList.saleList
        },
        itemList():ItemListData {
            return this.HomeList.itemList
        }
    }
       
})
